const scanCode = () => {
	return new Promise(resolve => {
		uni.scanCode({
			success: function(res) {
				resolve(res)
			},
			fail(err) {
				resolve({
					err: err
				})
			}
		})
	})
}

const setClipboardData = (data) => {
	return new Promise(resolve => {
		uni.setClipboardData({
			data: data,
			success: function(res) {
				resolve(res)
			},
			fail(err) {
				resolve({
					err: err
				})
			}
		});
	})
}
const getClipboardData = (data) => {
	return new Promise(resolve => {
		uni.getClipboardData({
			success: function(res) {
				resolve(res)
			},
			fail(err) {
				resolve({
					err: err
				})
			}
		});
	})
}
const InstallRestart = (path) => {
	return new Promise(reslove => {
		plus.runtime.install(path, {
			force: true
		}, (res) => {
			reslove(res)
		}, (e) => {
			reslove({
				err:e
			})
		})
	})
}

const restart = ()=>{
	plus.runtime.restart()
}
export default {
	scanCode,
	setClipboardData,
	getClipboardData,
	InstallRestart,
	restart
}
